package com.excuse.excusebuilder.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.excuse.excusebuilder.R;
import com.excuse.excusebuilder.bean.Result;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

/**
 * Created by 鹏君 on 2017/4/18.
 */

public class ExcuseActivityAdapter extends RecyclerArrayAdapter<Result> {
    public ExcuseActivityAdapter(Context context) {
        super(context);
    }


    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyViewHolder(parent);
    }

    class MyViewHolder extends BaseViewHolder<Result> {
        TextView contentTv;
        TextView positionTv;

        public MyViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_excuse_activity);

            contentTv = $(R.id.content);
            positionTv = $(R.id.position_tv);

        }

        @Override
        public void setData(Result data) {
            super.setData(data);
            contentTv.setText(data.getContent());
            positionTv.setText(getAdapterPosition() + 1 + ". ");
        }
    }
}
